package com.wunong.smart.bigdata.flink.job;

import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * union calculator
 *
 * @author created by zealot.zt
 */
public class StringUnionJob {

    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment()
                .setParallelism(1);

        // 流1
        DataStream<String> stream1 = env.fromElements("DROP", "IGNORE");

        // 流2
        DataStream<String> stream2 = env.fromElements("Apache", "DROP", "Flink", "IGNORE");

        // 实现流合并，仅是结果的合并，不会去重
        stream1.union(stream2).print("Result");

        env.execute(StringUnionJob.class.getName());
    }

}